//
//  OJIssue.h
//  openJira
//
//  Created by Vincent Demay on 29/04/10.
//  Copyright 2010 Goojet. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OJConnector.h"
#import "OJXMLRPCModel.h"
#import "OJFilter.h"
#import "OJPriority.h"
#import "OJType.h"
#import "OJStatus.h"

@protocol OJIssueDelegate;


@class OJFilter, OJPriority, OJType, OJStatus;
@class OJXMLRPCModel;

@interface OJIssue : OJXMLRPCModel {
	OJStatus* status;
	NSString *reporter;
	//TODO : fixversion;
	NSString *key;
	OJType* type;
	NSString *updated;
	OJPriority* priority;
	//TODO : components
	//TODO : affectsVersion
	NSString *assigne;
	NSString *summary;
	//TODO : customFieldValues
	int vote;
	int lid;
	NSString *description;
	NSString *project;
	NSString *created;
	
	id<OJIssueDelegate> delegate;
}

@property (nonatomic, retain) OJStatus *status;
@property (nonatomic, retain) NSString *reporter;
@property (nonatomic, retain) NSString *key;
@property (nonatomic, retain) OJType* type;
@property (nonatomic, retain) NSString *updated;
@property (nonatomic, retain) NSString *assigne;
@property (nonatomic, retain) OJPriority *priority;
@property (nonatomic, retain) NSString *summary;
@property (nonatomic) int vote;
@property (nonatomic) int lid;
@property (nonatomic, retain) NSString *description;
@property (nonatomic, retain) NSString *project;
@property (nonatomic, retain) NSString *created;
@property (nonatomic, assign) id<OJIssueDelegate> delegate;

- (void) createIssue;

- (NSDictionary*) toNSDictionnary;

@end


@protocol OJIssueDelegate
- (void) object:(OJIssue*) filter isCreated:(BOOL) onError;
@end

/////////////////////// OJLISTFILTER ////////////////////////
@protocol OJIssueListDelegate;

@interface OJIssueList : OJXMLRPCModel {
	NSMutableArray *issues;
	id<OJIssueListDelegate> delegate;
}
@property (nonatomic, retain) NSMutableArray *issues;
@property (nonatomic, assign) id<OJIssueListDelegate> delegate;
- (void) getIssuesFromFilter:(OJFilter*) filter;
@end


@protocol OJIssueListDelegate
- (void) object:(OJIssueList*) filter isReady:(BOOL) onError;

@end
